****This do file relates to Appendix OC where we look at age as a potential moderator factor
***for disagreement; the first set of analyses look at the potential non-lineary of 
***attitude strength by age (while controlling for partisan disagreement), 
***while the second set look at whether age moderates either disagreement measures


******Predicted Attitude Strength by Age***
		*Importance*
		eststo clear
		regress samesex10imp c.partydiff c.age c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
		margins, at(age=(20(10)80)) post
		estimates store SS
		regress richtaxes10imp c.partydiff c.age c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
		margins, at(age=(20(10)80)) post
		estimates store RT
		regress medic10imp c.partydiff c.age c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
		margins, at(age=(20(10)80)) post
		estimates store ME
		regress drugs10imp c.partydiff c.age c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
		margins, at(age=(20(10)80)) post
		estimates store DR
		regress path10imp c.partydiff c.age c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
		margins, at(age=(20(10)80)) post
		estimates store PA
		regress illeg10imp c.partydiff c.age c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
		margins, at(age=(20(10)80)) post
		estimates store ILL
		regress habeas10imp c.partydiff c.age c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
		margins, at(age=(20(10)80)) post
		estimates store HAB
		regress phone10imp c.partydiff c.age c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
		margins, at(age=(20(10)80)) post
		estimates store PHONE
	
		*Extremity*
		regress samesex10ext c.partydiff c.age c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
		margins, at(age=(20(10)80)) post
		estimates store SS1
		regress richtaxes10ext c.partydiff c.age c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
		margins, at(age=(20(10)80)) post
		estimates store RT1
		regress medic10ext c.partydiff c.age c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
		margins, at(age=(20(10)80)) post
		estimates store ME1
		regress drugs10ext c.partydiff c.age c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
		margins, at(age=(20(10)80)) post
		estimates store DR1
		regress path10ext c.partydiff c.age c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
		margins, at(age=(20(10)80)) post
		estimates store PA1
		regress illeg10ext c.partydiff c.age c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
		margins, at(age=(20(10)80)) post
		estimates store ILL1
		regress habeas10ext c.partydiff c.age c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
		margins, at(age=(20(10)80)) post
		estimates store HAB1
		regress phone10ext c.partydiff c.age c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
		margins, at(age=(20(10)80)) post
		estimates store PHONE1

		*Creating the graph
			coefplot (SS, label(Importance)) (SS1, label(Extremity)), bylabel(Same Sex Marriage) ||  ///
			RT RT1, bylabel(Taxes on the Rich) || ///
			DR DR1, bylabel(Drugs for Seniors)|| ///
			ME ME1, bylabel(Gov't Medical Care) || ///
			HAB HAB1, bylabel(Habeas Corpus) || ///
			PHONE PHONE1, bylabel(Wiretaps) || ///
			ILL ILL1, bylabel(Immigrant Work Stay) || ///
			PA PA1, bylabel(Path to Citizenship) ||, ///
			noci at recast(line)
						
						
						
**********Moderation Analysess
		*importance
			*partisan disagreement*
			drop _est_*
			eststo clear
			eststo: regress samesex10imp c.pdiff_avg c.age c.age#c.age c.pdiff_avg#c.age c.pdiff_avg#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(pdiff_avg) at(age=(20(10)80)) post
			estimates store SS
			eststo: regress richtaxes10imp c.pdiff_avg c.age c.age#c.age c.pdiff_avg#c.age c.pdiff_avg#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(pdiff_avg) at(age=(20(10)80)) post
			estimates store RT
			eststo: regress medic10imp c.pdiff_avg c.age c.age#c.age c.pdiff_avg#c.age c.pdiff_avg#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(pdiff_avg) at(age=(20(10)80)) post
			estimates store ME
			eststo: regress drugs10imp c.pdiff_avg c.age c.age#c.age c.pdiff_avg#c.age c.pdiff_avg#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(pdiff_avg) at(age=(20(10)80)) post
			estimates store DR
			eststo: regress path10imp c.pdiff_avg c.age c.age#c.age c.pdiff_avg#c.age c.pdiff_avg#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(pdiff_avg) at(age=(20(10)80)) post
			estimates store PA
			eststo: regress illeg10imp c.pdiff_avg c.age c.age#c.age c.pdiff_avg#c.age c.pdiff_avg#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(pdiff_avg) at(age=(20(10)80)) post
			estimates store ILL
			eststo: regress habeas10imp c.pdiff_avg c.age c.age#c.age c.pdiff_avg#c.age c.pdiff_avg#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(pdiff_avg) at(age=(20(10)80)) post
			estimates store HAB
			eststo: regress phone10imp c.pdiff_avg c.age c.age#c.age c.pdiff_avg#c.age c.pdiff_avg#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(pdiff_avg) at(age=(20(10)80)) post
			estimates store PHONE
			esttab using partydiff_imp_byage.rtf, addnotes(Results are from OLS models. Cell entries are unstandardized coefficients. Analyses are weighted (wgtL10).) onecell star(+ 0.10 * 0.05 ** 0.01) label se ar2
			
			*general disagreement*
			eststo clear
			eststo: regress samesex10imp c.gendiff c.age c.age#c.age c.gendiff#c.age c.gendiff#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(gendiff) at(age=(20(10)80)) post
			estimates store SS1
			eststo: regress richtaxes10imp c.gendiff c.age c.age#c.age c.gendiff#c.age c.gendiff#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(gendiff) at(age=(20(10)80)) post
			estimates store RT1
			eststo: regress medic10imp c.gendiff c.age c.age#c.age c.gendiff#c.age c.gendiff#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(gendiff) at(age=(20(10)80)) post
			estimates store ME1
			eststo: regress drugs10imp c.gendiff c.age c.age#c.age c.gendiff#c.age c.gendiff#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(gendiff) at(age=(20(10)80)) post
			estimates store DR1
			eststo: regress path10imp c.gendiff c.age c.age#c.age c.gendiff#c.age c.gendiff#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(gendiff) at(age=(20(10)80)) post
			estimates store PA1
			eststo: regress illeg10imp c.gendiff c.age c.age#c.age c.gendiff#c.age c.gendiff#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(gendiff) at(age=(20(10)80)) post
			estimates store ILL1
			eststo: regress habeas10imp c.gendiff c.age c.age#c.age c.gendiff#c.age c.gendiff#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(gendiff) at(age=(20(10)80)) post
			estimates store HAB1
			eststo: regress phone10imp c.gendiff c.age c.age#c.age c.gendiff#c.age c.gendiff#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(gendiff) at(age=(20(10)80)) post
			estimates store PHONE1
			esttab using gendiff_imp_byage.rtf, addnotes(Results are from OLS models. Cell entries are unstandardized coefficients. Analyses are weighted (wgtL10).) onecell star(+ 0.10 * 0.05 ** 0.01) label se ar2

			**creating the graph***
			coefplot (SS, label(Partisan Disagreement)) (SS1, label(General Disagreement)), bylabel(Same Sex Marriage) || ///
			RT RT1, bylabel(Taxes on the Rich) || DR DR1, bylabel(Drugs for Seniors)|| ME ME1, bylabel(Gov't Medical Care) || ///
			HAB HAB1, bylabel(Habeas Corpus) || PHONE PHONE1, bylabel(Wiretaps) || ILL ILL1, bylabel(Immigrant Work Stay) || ///
			PA PA1, bylabel(Path to Citizenship) ||, noci at recast(line) yline(0, lpattern(dash)) ylabel(-.4(0.20)0.4) byopts(title(Marginal Effect of Disagreement on Importance by Age))

		*attitude extremity
			*partisan disagreement
			drop _est_*
			eststo clear
			eststo: regress samesex10ext c.pdiff_avg c.age c.age#c.age c.pdiff_avg#c.age c.pdiff_avg#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(pdiff_avg) at(age=(20(10)80)) post
			estimates store SS
			eststo: regress richtaxes10ext c.pdiff_avg c.age c.age#c.age c.pdiff_avg#c.age c.pdiff_avg#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(pdiff_avg) at(age=(20(10)80)) post
			estimates store RT
			eststo: regress medic10ext c.pdiff_avg c.age c.age#c.age c.pdiff_avg#c.age c.pdiff_avg#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(pdiff_avg) at(age=(20(10)80)) post
			estimates store ME
			eststo: regress drugs10ext c.pdiff_avg c.age c.age#c.age c.pdiff_avg#c.age c.pdiff_avg#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(pdiff_avg) at(age=(20(10)80)) post
			estimates store DR
			eststo: regress path10ext c.pdiff_avg c.age c.age#c.age c.pdiff_avg#c.age c.pdiff_avg#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(pdiff_avg) at(age=(20(10)80)) post
			estimates store PA
			eststo: regress illeg10ext c.pdiff_avg c.age c.age#c.age c.pdiff_avg#c.age c.pdiff_avg#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(pdiff_avg) at(age=(20(10)80)) post
			estimates store ILL
			eststo: regress habeas10ext c.pdiff_avg c.age c.age#c.age c.pdiff_avg#c.age c.pdiff_avg#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(pdiff_avg) at(age=(20(10)80)) post
			estimates store HAB
			eststo: regress phone10ext c.pdiff_avg c.age c.age#c.age c.pdiff_avg#c.age c.pdiff_avg#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(pdiff_avg) at(age=(20(10)80)) post
			estimates store PHONE
			esttab using partydiff_ext_byage.rtf, addnotes(Results are from OLS models. Cell entries are unstandardized coefficients. Analyses are weighted (wgtL10).) onecell star(+ 0.10 * 0.05 ** 0.01) label se ar2
		
			*general disagreement
			eststo clear
			eststo: regress samesex10ext c.gendiff c.age c.age#c.age c.gendiff#c.age c.gendiff#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(gendiff) at(age=(20(10)80)) post
			estimates store SS1
			eststo: regress richtaxes10ext c.gendiff c.age c.age#c.age c.gendiff#c.age c.gendiff#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(gendiff) at(age=(20(10)80)) post
			estimates store RT1
			eststo: regress medic10ext c.gendiff c.age c.age#c.age c.gendiff#c.age c.gendiff#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(gendiff) at(age=(20(10)80)) post
			estimates store ME1
			eststo: regress drugs10ext c.gendiff c.age c.age#c.age c.gendiff#c.age c.gendiff#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(gendiff) at(age=(20(10)80)) post
			estimates store DR1
			eststo: regress path10ext c.gendiff c.age c.age#c.age c.gendiff#c.age c.gendiff#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(gendiff) at(age=(20(10)80)) post
			estimates store PA1
			eststo: regress illeg10ext c.gendiff c.age c.age#c.age c.gendiff#c.age c.gendiff#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(gendiff) at(age=(20(10)80)) post
			estimates store ILL1
			eststo: regress habeas10ext c.gendiff c.age c.age#c.age c.gendiff#c.age c.gendiff#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(gendiff) at(age=(20(10)80)) post
			estimates store HAB1
			eststo: regress phone10ext c.gendiff c.age c.age#c.age c.gendiff#c.age c.gendiff#c.age#c.age c.interest10 c.pid10 c.ideology10 i.gender  c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, dydx(gendiff) at(age=(20(10)80)) post
			estimates store PHONE1
			esttab using gendiff_ext_byage.rtf, addnotes(Results are from OLS models. Cell entries are unstandardized coefficients. Analyses are weighted (wgtL10).) onecell star(+ 0.10 * 0.05 ** 0.01) label se ar2

			*creating the graph*
			coefplot (SS, label(Partisan Disagreement)) (SS1, label(General Disagreement)), bylabel(Same Sex Marriage) || ///
			RT RT1, bylabel(Taxes on the Rich) || DR DR1, bylabel(Drugs for Seniors)|| ME ME1, bylabel(Gov't Medical Care) || ///
			HAB HAB1, bylabel(Habeas Corpus) || PHONE PHONE1, bylabel(Wiretaps) || ILL ILL1, bylabel(Immigrant Work Stay) ||  ///
			PA PA1, bylabel(Path to Citizenship) ||, noci at recast(line) yline(0, lpattern(dash)) ylabel(-.4(0.10)0.2) byopts(title(Marginal Effect of Disagreement on Extremity by Age))



